home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-28 | 4.2 KB | 141 lines |
- '***************************
- '* AMOS Professional *
- '* *
- '* AMAL_6 * Synchro
- '* *
- '* (c) Europress Software *
- '* *
- '* Ronnie Simpson *
- '***************************
- '
- '-------------------------------------------
- 'The interupt system allows a maximum of 16 Amal programs to be run at any
- 'one time, with the use of Synchro this restriction is lifted by-passing
- 'the interupt system and stepping through the Amal programs directly from
- 'Basic.
- 'Channel numbers can now range from 0-63 with the added bonus of collision
- 'detection being possible from within your Amal program.
- 'Amal strings are defined as normal but before assigning the channels the
- 'Synchro Off is used which turns off the interupts allowing the extra
- 'channels 16-63 to be used, then with each call to Synchro the Amal programs
- 'will be stepped through.
- '
- ' Define Amal strings
- ' Switch off interupts with Synchro Off
- ' Assign Amal strings to the channels 0-63
- ' Amal On
- ' Do
- ' Synchro
- ' Loop
- '
- 'Interupts can be switched back on again with the Synchro On command reducing
- 'channel numbers back to the normal 0-15
- '
- '-------------------------------------------
- ' =BC =SC
- '-------------------------------------------
- 'Amal bob and sprite collision detection
- '
- 'These functions are only possible when interupts have been switched off with
- 'the Synchro Off and are identical in operation to the Bob Col & Sprite Col
- 'functions in AMOS Professional Basic.
- '
- ' +--->object number to be tested
- ' | +--->range of objects to be tested against
- ' | / \
- ' Let R0=BC(1,5,8)
- ' If SC(5,1,4) Jump Hit
- '
- 'If a collision has occured a value of -1 (True) will be returned otherwise
- 'it will be 0 (False).
- '
- '-------------------------------------------
- ' =C
- '-------------------------------------------
- 'Amal collision status function
- '
- 'This function returns the status of an object after a BC or SC function.
- 'Once again this function can only be used when Synchro Off is in operation.
- '
- ' +--->object number to be tested
- ' Let R0=C(5)
- ' If C(2) Jump Ouch
- '
- 'If the object has collided then -1 (True) will be returned otherwise it will
- 'be 0 (False).
- '
- '-------------------------------------------
- 'EXAMPLE
- '-------------------------------------------
- Rem *** Load the bird bobs
- Load "AMOSPro_Tutorial:Objects/Amal_bobs.abk"
- '
- Rem *** tidy up the screen and double buffer
- Screen Open 0,320,200,8,Lowres
- Curs Off : Flash Off : Cls 0 : Get Sprite Palette : Hide
- Double Buffer
- Paper 0 : Pen 2 : Locate 0,3 : Centre "Migration time...."
- Pen 4 : Locate 0,20 : Centre "Left mouse key to add some more birds"
- Pen 1 : Locate 0,22 : Centre "Right mouse key to quit"
- '
- Rem *** Switch off interrupts
- '
- Synchro Off
- '
- Rem *** Define Amal strings
- '
- A$="Anim 0,(5,2)(6,2)(7,2)(8,2);"
- A$=A$+"Loop: Let R0=Z(255)+Z(63)-X; Let R1=Z(127)+Z(63)-Y; Let RZ=Z(15)+4;"
- A$=A$+"Move R0,R1,RZ; Jump Loop"
- B$="Anim 0,(1,2)(2,2)(3,2)(4,2);"
- B$=B$+"Loop: Let R0=Z(255)+Z(63)-X; Let R1=Z(127)+Z(63)-Y; Let RZ=Z(15)+4;"
- B$=B$+"Move R0,R1,RZ; Jump Loop"
- C$="Loop:For R0=1 To 5; Pause; Next R0; Pause Jump Loop"
- D$="Anim 0,(5,2)(6,2)(7,2)(8,2);Move 300,0,150"
- E$="Anim 0,(1,2)(2,2)(3,2)(4,2);Move -300,0,150"
- '
- Rem *** assign the 63 channels
- '
- For N=0 To 63
- Bob N,800,400,1
- Set Bob N,1,%111,
- Channel N To Bob N
- Amal N,C$
- Next
- For N=0 To 15
- If Rnd(1)=0
- Amal N,A$ : Amal On N
- Else
- Amal N,B$ : Amal On N
- End If
- Next
- COUNT=16
- '
- Rem *** start the Main loop
- '
- Repeat
- If COUNT<63 and Mouse Key=1
- Inc COUNT
- Bob COUNT,Rnd(320)+1,Rnd(200)+1,Rnd(3)+1
- If Rnd(1)=0
- Amal COUNT,A$ : Amal On COUNT
- Else
- Amal COUNT,B$ : Amal On COUNT
- End If
- End If
- Synchro : Wait Vbl
- Until Mouse Key=2
- Fade 8,$44F
- Clw : Pen 6 : Locate 0,12 : Centre "Bye, bye, Birdies!"
- For N=0 To 63
- If I Bob(N)<5
- Amal N,E$
- Else
- Amal N,D$
- End If
- Amal On N
- Next
- For N=1 To 150
- Synchro : Wait Vbl
- Next
- Edit